<?php
session_start();
require_once(dirname(__FILE__).'/../stork_config.php');

function __autoload($sName)
{
	echo '['.$sName.']<br />';
	switch(substr($sName, 0, 1))
	{
	case 'c':
		$sPath = dirname(__FILE__).'/scripts/php/class/'.$sName.'.php';
		$sExceptionInfo = STORK_CLASS_NOT_FOUND;
		break;
	case 'v':
		$sPath = dirname(__FILE__).'/scripts/php/view/'.$sName.'.php';
		$sExceptionInfo = STORK_VIEW_NOT_FOUND;
		break;
	case 'a':
		$sPath = dirname(__FILE__).'/scripts/php/action/'.$sName.'.php';
		$sExceptionInfo = STORK_ACTION_NOT_FOUND;
		break;
	default:
		$sExceptionInfo = STORK_FILE_NOT_FOUND;
	}

	if(!file_exists($sPath))
	{
		throw new cException($sName, $sExceptionInfo, STORK_STATE_ERROR);
	}
	else
	{
		require_once($sPath);
	}
}

?>
